package com.zkc.blog.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * 前台页面访问控制器
 * @author Administrator
 */
@Controller
public class IndexController {

		
	@RequestMapping("/index")
	public String hellothymeleaf(Model mv){
		return "index";
	}
	@RequestMapping("/showaboutweb")
	public String aboutweb(
			Model mv){
		return "aboutweb";
	}
	@RequestMapping("/showarchive")
	public String archive(
			Model mv){
		return "archive";
	}
	@RequestMapping("/showblog")
	public String blog(
			@RequestParam(name="blogid",defaultValue="1") Integer id,
			Model mv){
		mv.addAttribute("blogid", id);
		return "blog";
	}
	@RequestMapping("/showblogcate")
	public String blogcate(
			@RequestParam(name="cateid",defaultValue="0") Integer id,
			Model mv){
		mv.addAttribute("cateid", id);
		return "blogcate";
	}
	@RequestMapping("/showuserPage")
	public String userPage(Model mv){
		
		return "userPage";
	}
	/*
	 * 前台搜索功能
	 */
	@RequestMapping("/searchBlog")
	public String searchBlog(
			@RequestParam(name="searchkey",defaultValue="") String searchkey,
			Model mv){
		mv.addAttribute("searchkey", searchkey);
		return "index";
	}

}
